@echo off
setlocal enabledelayedexpansion

set "srcDir=Z:\GameSvr\src\com\protocpp"
set "target=D:\test\GameSvr\src\com\protocpp"


echo cp *.pb.*
xcopy /y /c /h /r /i "%srcDir%\*" "%target%\" 

if errorlevel 1 (
    echo dir wrong
    exit /b 1
)

echo rename .pb.cc to .pb.cpp...
for /r "%target%" %%f in (*.pb.cc) do (
    rem ren "%%f" "%%~nf.cpp" 2>nul
    rem vs浏览的情况需要改为cpp，这里屏蔽
    if exist "%%~dpnf.cpp" (
        echo rename: "%%~nxf" → "%%~nf.cpp"
    )
)

echo finish
pause